Skip to content

site: format error cards on reactivescript.dev - #72

Open
simonzeiger wants to merge 1 commit into
solidjs:mainfrom
simonzeiger:feat/site-diagnostics
Open

simonzeiger wants to merge 1 commit into
solidjs:mainfrom
simonzeiger:feat/site-diagnostics

Conversation

@simonzeiger

Copy link
Copy Markdown

Summary

Even if agents read most .rx errors day to day, humans still read reactivescript.dev to decide whether to try the language, and the compiler errors are a big part of that pitch. On site/index.html, longer examples like GUESS_WHILE_LOADING and HELD_WRITE currently render as 400–500 character single-color lines where the problem, spec rule, and three or four suggested fixes all run together.

This updates the 5 <pre class="err"> cards on site/index.html to render as rustc-style blocks — error[CODE] (rule) headline, --> file:line:col, source line + ^^^ carets, and bulleted = help: options.

Matching compiler follow-up: The formatter producing this exact output in compiler/ (rxc on interactive TTYs, Vite, rx-tsc --pretty, and a tests/format.rs sync check for site/index.html — while keeping piped/agent CLI output to a single plain line per error so agents pay zero extra tokens) is ready in simonzeiger/reactivescript#2. Opened site/index.html (+64 / -8) on its own first to get feedback on the visual format before dropping a larger compiler PR — happy to tweak the styling or open Part 2 right away if this direction looks good.

Before & After (site/index.html)

Before (main) After (feat/site-diagnostics)
Before — like.rx After — like.rx
Before — save.rx & tags.rx After — save.rx & tags.rx

Copy link
Copy Markdown
Member

Thanks for working on the error cards! Two things need to change before this can go in:

  1. The format isn't what the compiler prints. The cards show a rustc-style error[CODE] (rule): … --> file:line:col, with the source line, carets and a help: list. But rxc, rx-tsc and the Vite plugin print file:line:col - error CODE: message (rule). The site should show what people will actually see in their terminal. If you'd like the compiler itself to print this richer format, that would be a welcome proposal, but in a separate PR that changes the compiler's output.
  2. The page changed under it. Round 15 eval, catch only after await, guesses over writables, Solid main 99db9bc #71 just landed. catch is now allowed only after an await (CATCH_NOT_ON_AWAIT, R-f-4), so the "or catch it: … catch (e) => …" advice in the UNHANDLED_FAILURE cards is out of date. site/index.html on main was updated for that, and this branch now conflicts with it.

If you rebase onto main and keep the colour styling on the current one-line messages, that part is an easy yes.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants